<template>
  <div class="init">
    <div  class="up">
      <h3 class="titl">
        <span>{{mv.title}}</span>
        <i class="el-icon-magic-stick"></i>
      </h3>
      <ul>
        <li v-for="(z1,index) in mv.subjects" v-if="index<10||flage&&index<20" :key="z1.name">
          <div class="img" @click.prevent="fn(z1)"  :style="{ backgroundImage: `url(${z1.cover})` }" v-if="index<10||flage&&index<20"></div>
          <a  class="channels"  v-if="index<10||flage&&index<20">{{z1.name}}</a>
          <p v-if="index<10||flage&&index<20">{{z1.description}}</p>
        </li>
      </ul>
    </div>
    <button  class="but button" @click="tik" v-if="flage===false">加载更多兆赫</button>
  </div>
</template>

<script>
export default {
  name: "Artist",
  data(){
    return{
      flage:false,
      mv:{
        title:"",
        subjects:[
          {
            cover:"",
            name:"",
            description:""
          }
        ]
      }
    }
  },
  methods:{
    tik(){
      this.flage=!this.flage
    },
    fn(z1){
      this.$store.commit('setArtistData',z1.master);
      console.log(this.$store.getters.getArtistData);
    }
  },
  created() {
    const _this = this;
    axios.get('http://localhost:8181/beforeindex').then(function (resp) {
      // console.log(resp)
      _this.mv = resp.data
    })
  }
}
</script>

<style scoped>

ul{

  display: flex;
  max-width: 1024px;
  overflow-y:hidden;
  word-wrap:break-word;
  overflow-x:auto;
  box-sizing: border-box;
  text-align: center;
  flex-wrap: wrap;
}
li{
  margin-left: 0;
  display: block;
  width: 204px;
  height: 248px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: rgb(241, 241, 241);
  text-align: center;
}
a{
  text-decoration: none;
}
.img{
  cursor:pointer;
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  height: 108px;
  width: 108px;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-size: cover;
}
.channels{
  display: inline-block;
  margin-top: 20px;
  font-size: 14px;
  color: #4a4a4a;
  line-height: 18px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
p{
  margin-top: 8px;
  padding: 0 10px;
  max-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 16px;
  font-size: 12px;
  color: #acacac;
  font-weight: 500;
}
h3{
  text-align: left;
  margin: 0;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 400;
  color: #9b9b9b;
  line-height: 20px;
}
.but{
  background: #fff;
  border: 0.5px solid #e1e1e1;
  border-radius: 2px;
  font-size: 12px;
  color: #9b9b9b;
  line-height: 30px;
  height: 30px;
  margin-top: 30px;
  padding: 0 20px;
  margin-bottom: 30px;
}
.but:hover{
  text-decoration: none;
  color: #9b9b9b;
  opacity: 0.5;
}
.button{
  display: inline-block;
  position: relative;
  height: 38px;
  padding: 0 16px;
  color: rgba(0,0,0,.44);
  background: transparent;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.15);
  vertical-align: bottom;
  white-space: nowrap;
  text-rendering: auto;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-sizing: border-box;
  letter-spacing: -.02em;
  font-weight: 400;
  font-style: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -moz-font-feature-settings: "liga" on;
}

</style>